function [Accuracy,p_Accuracy]=shit2(all_mat,permutation,group1_number,group2_number)
%%

total_number=group1_number+group2_number;
Accuracy_index=zeros(permutation,total_number);
label=[(-1)*ones(group1_number,1); ones(group2_number,1)];
label_index = repmat(label,[1,permutation]);
for p=1:permutation%�û�����ı�ǩ
    if p>1
        label_index(:,p) = label(randperm(total_number));
    else
        label_index(:,p)= label_index(:,1);
    end
    %��һ��Ϊ��ʽ��ģ�ͣ�֮��Ķ����û����������
end
%����������֤Ҫ�õ�index��Ϊ�˱�֤������֤������ȶ���������˳��ÿ��ɾ����һ����ʹ��crossvalind�����ᵼ�½������һ���̶ȵĲ�����
test_index=eye(total_number);
train_index=ones(total_number)-test_index;
test_index=test_index==1;
train_index=train_index==1;

%%�û������뽻����֤
for pp=1:permutation
    parfor i=1:total_number%������֤
        
        train=train_index(i,:);
        test=test_index(i,:);
        
        train_data=all_mat(train,:);
        %׼��������ѵ�����Ա���
        label_p=label_index(:,pp);
        train_label=label_p(train,:);
        %������������ѵ�����������
        test_data=all_mat(test,:);
        %�������������Ա������Լ�
        test_label=label_p(test,:);
        %������������������Ĳ��Լ���������֮ǰ��һ��
        %=========================================================================
        model = svmtrain(train_label,train_data,'-t 0 -q');
        %����ó�SVM��ģ��
        [predicted_label,Accuracy,deci] = svmpredict(test_label,test_data,model);
        %ͨ��ģ�����Ԥ�����������ȷ�ʣ��Լ�һ����Ҳ��֪����ʲô��ֵ���ƺ���������ACC��
        Accuracy_index(pp,i)=Accuracy(1);
    end
    
    %%
    
    Accuracy=mean(Accuracy_index');
    %�������ָ��.
    p_Accuracy=mean(Accuracy(1)<=Accuracy);
    %������û������pֵ
end
end
